package com.mars.basic.allmain.vo.article;

import com.mars.basic.allmain.po.Article;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

@Data
public class ArticleVo {

    Integer id;
    @NotBlank(message = "题目不能为空")
    String title;

    String author;
    @NotBlank(message = "路径不能为空")
    String url;

    String status = "0";

    Integer userId;

    public Article build() {
        Article article = Article.builder().status(status)
                .updateTime(new Date())
                .url(url)
                .title(title)
                .build();
        return article;
    }
}
